home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagd_f.zip / FILES.SWG / 0001_FILATTR1.PAS.pas next >
Pascal/Delphi Source File  |  1993-05-28  |  1KB  |  41 lines

  1. {> How does one go about changing a File attribute
  2. > from hidden to unhidden using SetFAttr ?
  3.  
  4. Try these two Procedures on For size:
  5. }
  6. GetFAttr(FName:String;Var RdOnly,Hid,Sys,Arch:Boolean);
  7. Var R:Registers;
  8. begin
  9.   FillChar(R,Sizeof(R),0);
  10.   FName := FName+#0; { set up as a null-terminated String For Dos }
  11.   With R Do begin
  12.     AH := $43;
  13.     DS := Seg(FName); DX := ofs(FName)+1; { skip pascal length Byte }
  14.     MsDos(R);
  15.     RdOnly := (CL and $01) > 0;
  16.     Hid := (CL and $02) > 0;
  17.     Sys := (CL and $04) > 0;
  18.     Arch := (CL and $20) > 0;
  19.     end; { With }
  20. end; { GetFAttr }
  21.  
  22. PutFAttr(FName:String;RdOnly,Hid,Sys,Arch:Boolean);
  23. Var R:Registers;
  24. begin
  25.   FillChar(R,Sizeof(R),0);
  26.   FName := FName+#0; { set up as a null-terminated String For Dos }
  27.   With R Do begin
  28.     AH := $43; AL := 1;
  29.     DS := Seg(FName); DX := ofs(FName)+1; { skip pascal length Byte }
  30.     if RdOnly then CL := CL or $01;
  31.     if Hid then CL := CL or $02;
  32.     if Sys then CL := CL or $04;
  33.     if Arch then CL := CL or $20;
  34.     MsDos(R);
  35.     end; { With }
  36. end; { PutFAttr }
  37.  
  38. {The File FName does not have to be opened For this to work.  In fact, it
  39. would probably be better if it were not.
  40. }
  41.